#include"threadpoll.hh"
#include"Task.hh"
#include<memory>
#include<iostream>

using std::cout;
using std::endl;
using std::unique_ptr;

int main(void)
{
    //创建一个ptr
    std::shared_ptr<MyTask> _pt(new MyTask());

    ThreadPool pool(4,10);

    pool.start();

    for(int i=0;i<20;i++)
    {
        pool.addTask(std::bind(&MyTask::process,_pt.get()));
        cout<<"now i: "<<i<<endl;
    }

    pool.stop();
    cout<<endl<<endl<<" double_free"<<endl;
    getchar();
    return 0;
}
